<?php
	class Connection
	{
		
		const DNS = 'mysql:host=localhost;dbname=sadd';
		const USERNAME = "root";
		const PASSWORD = "";
		
		private static  $instance;
		
		private function  __construct()
		{
		}
		
		public static function getInstance()
		{
			try {
				if(!isset(self::$instance))
				{
					self::$instance = new PDO(self::DNS, self::USERNAME, self::PASSWORD,
											  array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"));
					self::$instance->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
					self::$instance->setAttribute(PDO::ATTR_ORACLE_NULLS, PDO::NULL_EMPTY_STRING);
				}
			
			}
			catch (PDOException $erro)
			{
				echo $erro->getMessage();
			}
			return self::$instance;
			
		}
	}
?>